package com.example.videoworks.mapper;

import com.example.videoworks.entity.Principal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.security.PublicKey;
import java.util.List;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Lily
 * @since 2023-05-11
 */
@Mapper
public interface PrincipalMapper extends BaseMapper<Principal> {
    @Select("SELECT name,birthYear,profession,personImg FROM principal WHERE name LIKE CONCAT('%',#{name},'%')")
    public List<Principal> searchName(String name);

    @Select("SELECT name,birthYear,profession,personImg FROM principal WHERE profession LIKE CONCAT('%',#{profession},'%')")
    public List<Principal> filtrateProfession(String profession);

    @Select("SELECT name,birthYear,profession,personImg FROM principal WHERE birthYear=#{birthYear}")
    public List<Principal> filtrateBirthYear(String birthYear);

    @Select("SELECT name,birthYear,profession,personIntroduction,personImg,knownForTitles FROM principal WHERE personId=#{personId}")
    public Principal principalDetails(String personId);
}
